package com.code.coinprice.exceptions;

/**
 * 无权限异常
 */
public class NoAuthorityException extends RuntimeException {

    private static final long serialVersionUID = -2732588474539601022L;

    private int errno = 600;

    private String errmsg;

    public NoAuthorityException() {
    }

    public NoAuthorityException(int errno) {
        super();
        this.errno = errno;
    }

    public NoAuthorityException(String errmsg) {
        super();
        this.errmsg = errmsg;
    }

    public NoAuthorityException(int errno, String errmsg) {
        super();
        this.errno = errno;
        this.errmsg = errmsg;
    }

    public int getErrno() {
        return errno;
    }

    public void setErrno(int errno) {
        this.errno = errno;
    }

    @Override
    public String getMessage() {
        return errmsg;
    }

    /**
     * 无权限错误异常
     *
     * @return 异常
     */
    public static NoAuthorityException noAuthority() {
        return new NoAuthorityException(401, "401");
    }

}
